﻿myApp.controller('NewSaleController', function ($scope, $http, DUMMY_DATA,$location, $window, $rootScope) {
    $scope.$emit('newPageLoaded', {
        'title': 'New Property For Sale | ShiJie Property',
        'description': 'New Property For Sale. We Work Very Closely With Developers. Over 40 Years Experience. Discover The Best New Property For Sale Today!',
        'keywords': 'new property for sale, property for sale, for sale new property'
    });

    $scope.isAndroid = $rootScope.isAndroid;

    //alert($scope.isAndroid);

    pageInit();

    $scope.property = {};
    $scope.property.Transact = "S";
    $scope.sortOption = "Sorted by High to Low";

    var BASE_URL;
    if ($location.host() == "localhost") {
        BASE_URL = $location.protocol() + "://" + "localhost:" + $location.port();
    } else {
        BASE_URL = $location.protocol() + "://" + $location.host();
    }


    $scope.getShareURL = function (p) {
        //  return (BASE_URL + "/property/" + p.propertyid + "/S" + p.Zoning[0]);
        return (BASE_URL + "/property/" + p.propertyid + "/" + p.SaleType);
    }

    $scope.getShareTitle = function (p) {
        return p.ShortHeading;
    }

    $scope.getShareDescription = function (p) {
        return p.LongHeading;
    }

    $scope.getShareImageURL = function (p) {
        return (p.PropertyURL || "https://c1.staticflickr.com/3/2280/32796837675_cd6b733c19_m.jpg");
    }

    $scope.getShareGoogleURL = function (p) {
        var url = BASE_URL + "/property/" + p.propertyid + "/" + $scope.property.Transact + p.Zoning[0];
        return encodeURI(encodeURI(url));
    }

    $scope.paginate = function (value) {
        var begin, end, index;
        begin = ($scope.currentPage - 1) * $scope.numPerPage;
        end = begin + $scope.numPerPage;
        index = $scope.searchData.indexOf(value);
        return (begin <= index && index < end);
    };

    $scope.isPropertyTransactSale = function (obj) {
        return obj == 'S' ? true : false;
    }


    $scope.go = function (key, value, transact) {
        console.log("TRANSACT: " + transact);
        console.log("CLICK!");
        value['transact'] = transact;
        var jsonObj = JSON.stringify(value);
        sessionStorage.setItem(key, jsonObj);
    }

    $scope.updateFilterOption = function (option, sortedChanged) {
        $scope.SortOptionChanged = sortedChanged;
        //$scope.$apply();
        console.log("HEY!" + option);
        switch (option) {
            case 0:
                $scope.sortOption = "Sorted by High to Low";
                $scope.sortKey = '-SalePrice';
                break;
            case 1:
                $scope.sortOption = "Sorted by Low to High";
                $scope.sortKey = 'SalePrice';
                break;
            case 2:
                $scope.sortOption = "Sorted by Area (A to Z)";
                $scope.sortKey = 'Project';
                break;
            case 3:
                $scope.sortOption = "Sorted by Area (Z to A)";
                $scope.sortKey = '-Project';
                break;
        }
    }

    $scope.isEmpty = function (obj) {
        for (var i in obj) if (obj.hasOwnProperty(i)) return false;
        return true;
    };


    $scope.is10Selected = true;
    $scope.is25Selected = false;
    $scope.is50Selected = false;
    $scope.is100Selected = false;
    $scope.changePerPage = function (npp) {
        $scope.numPerPage = npp;
        switch (npp) {
            case 10:
                $scope.is10Selected = true;
                $scope.is25Selected = false;
                $scope.is50Selected = false;
                $scope.is100Selected = false;
                break;
            case 25:
                $scope.is10Selected = false;
                $scope.is25Selected = true;
                $scope.is50Selected = false;
                $scope.is100Selected = false;
                break;
            case 50:
                $scope.is10Selected = false;
                $scope.is25Selected = false;
                $scope.is50Selected = true;
                $scope.is100Selected = false;
                break;
            case 100:
                $scope.is10Selected = false;
                $scope.is25Selected = false;
                $scope.is50Selected = false;
                $scope.is100Selected = true;
                break;
        }
        $scope.totalItems = $scope.searchData.length;
        $scope.currentPage = 1;
        $scope.numPerPage = npp;
    }


    function pageInit() {
        if (DUMMY_DATA == true) {
            var dummyData = [{ "propertyid": "8d1f82ee-d219-480b-982a-229ca528bb27", "Latitude": 5.369507, "Longitude": 100.389085, "road": "PERUSAHAAN JALAN", "location": "PRAI", "state": "PENANG MAINLAND", "type": "1/S DET", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 65340.00, "BuildUp": 30000.00, "Project": "KAWASAN PERINDUSTRIAN PRAI", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Leasehold", "Facing": "N/A", "Zoning": "Industrial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": null, "SIAmt": 7000000.00, "SLAmt": null, "SalePrice": 7000000.00, "UpdatedDate": "2016-11-07T11:42:56.693", "PropertyURL": null, "LongHeading": "SINGLE STOREY DETACHED, KAWASAN PERINDUSTRIAN PRAI", "ShortHeading": "1/S DET, KAWASAN PERINDUSTRIAN PRAI", "SaleType": "SI" }, { "propertyid": "aee15eb9-c6c3-433b-a20c-24a6c60f13dc", "Latitude": 0.000000, "Longitude": 0.000000, "road": "SAM AH CHOW JALAN", "location": "TANJUNG BUNGAH", "state": "PENANG ISLAND", "type": "2/S S/D", "staffid": "783322d9-f9a4-43d7-89bf-b63812f49173", "agentname": "STEPHEN FOO", "mobile": "0124852981", "email": "stephenfoo@lskworld.com", "StaffPicURL": "https://farm4.staticflickr.com/3774/18727760624_3ff97e89e0_o.jpg", "LandSqrtFt": 3000.00, "BuildUp": 2000.00, "Project": "TAMAN CONCORD", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 4, "Bathroom": 2, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 1200000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 1200000.00, "UpdatedDate": "2016-11-03T09:28:47.267", "PropertyURL": "https://farm6.staticflickr.com/5633/30111813604_c745446abd.jpg", "LongHeading": "DOUBLE STOREY SEMI-DETACHED, TAMAN CONCORD", "ShortHeading": "2/S S/D, TAMAN CONCORD", "SaleType": "SR" }, { "propertyid": "0e802660-e2d5-418e-bb9e-2c8bd6ae5039", "Latitude": 0.000000, "Longitude": 0.000000, "road": "TERATAI 2 JALAN", "location": "RAJA UDA", "state": "PENANG MAINLAND", "type": "3/S TER C", "staffid": "01e38f67-39f1-435a-94a8-21847ea4afe0", "agentname": "ALVIN TEH", "mobile": "0182575717", "email": "tjt@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/516/19162517368_b20643e0b1_o.jpg", "LandSqrtFt": 2780.00, "BuildUp": 3800.00, "Project": "TAMAN SRI TERATAI", "ProjectRemark": null, "Developer": null, "PropertyDesc": "renovated over 400k , can fit 4 car , with jacuzzi", "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 980000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 980000.00, "UpdatedDate": "2016-11-14T11:21:00.997", "PropertyURL": null, "LongHeading": "THREE STOREY TERRACE CORNER, TAMAN SRI TERATAI", "ShortHeading": "3/S TER C, TAMAN SRI TERATAI", "SaleType": "SR" }, { "propertyid": "6971e4e4-0d48-47a4-aa53-3455580ac3e0", "Latitude": 5.359573, "Longitude": 100.440272, "road": "NANGKA 11 LORONG    ", "location": "BUKIT MERTAJAM", "state": "PENANG MAINLAND", "type": "2/S TER", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 1400.00, "BuildUp": 1400.00, "Project": "TAMAN DESA DAMAI", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 400000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 400000.00, "UpdatedDate": "2016-11-08T15:23:36.533", "PropertyURL": null, "LongHeading": "DOUBLE STOREY TERRACE, TAMAN DESA DAMAI", "ShortHeading": "2/S TER, TAMAN DESA DAMAI", "SaleType": "SR" }, { "propertyid": "070c706e-b2a7-4f97-a07b-348fae6c514a", "Latitude": 0.000000, "Longitude": 0.000000, "road": "PANTAI SINARAN JALAN", "location": "GELUGOR", "state": "PENANG ISLAND", "type": "STUDIO", "staffid": "c3941803-c08f-45e2-a3d2-3dc83c43a3a0", "agentname": "ROBERT CHU", "mobile": "0125993677", "email": "robertchu@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/260/19162622820_745338b79c_o.jpg", "LandSqrtFt": 612.00, "BuildUp": 612.00, "Project": "THE LIGHT COLLECTION 2", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "", "FurnishedRemark": null, "Renovated": "", "RenovatedRemark": null, "Condition": "", "SRAmt": 850000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 850000.00, "UpdatedDate": "2016-11-07T13:38:29.58", "PropertyURL": null, "LongHeading": "ONE BEDROOM SUITE, THE LIGHT COLLECTION 2", "ShortHeading": "STUDIO, THE LIGHT COLLECTION 2", "SaleType": "SR" }, { "propertyid": "97b5612b-5b00-4805-8938-4c7aed71b355", "Latitude": 100.000000, "Longitude": 100.000000, "road": "KAMUNTING 2 JALAN", "location": "SELANGOR", "state": "SELANGOR", "type": "1.5/S DET", "staffid": "91296169-8651-4a10-8ea5-34a1697f7d28", "agentname": "LONG SOO KEAT", "mobile": "0183987777", "email": "longsookeat@lskworld.com", "StaffPicURL": "https://farm2.staticflickr.com/1459/26499442055_39490f0b1c_o.jpg", "LandSqrtFt": 10000.00, "BuildUp": 400.00, "Project": "BUKIT MERUNTUNG INDUSTRIAL PARK", "ProjectRemark": "test by Tan Chin Teong", "Developer": "TAN CHIN TEONG", "PropertyDesc": null, "Room": 3, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Commercial", "Furnished": "Furnished", "FurnishedRemark": "test", "Renovated": "", "RenovatedRemark": "test", "Condition": "", "SRAmt": null, "SCAmt": null, "SIAmt": 30000.00, "SLAmt": null, "SalePrice": 30000.00, "UpdatedDate": "2016-11-05T21:59:41.87", "PropertyURL": null, "LongHeading": "ONE & A HALF STOREY DETACHED, BUKIT MERUNTUNG INDUSTRIAL PARK", "ShortHeading": "1.5/S DET, BUKIT MERUNTUNG INDUSTRIAL PARK", "SaleType": "SI" }, { "propertyid": "5ce6f914-4950-4b10-baed-4d8d3d40537c", "Latitude": 0.000000, "Longitude": 0.000000, "road": "KAMPUNG SELAMAT 11 TINGKAT", "location": "TASEK GELUGOR", "state": "PENANG MAINLAND", "type": "AGR LAND", "staffid": "65a9016e-676b-4ee3-b79f-89288740c7a2", "agentname": "FRANKIE LEE", "mobile": "0174417313", "email": "frankielee@lskworld.com", "StaffPicURL": "https://farm4.staticflickr.com/3772/19344073372_a710d0f4d5_o.jpg", "LandSqrtFt": 657756.00, "BuildUp": 657756.00, "Project": null, "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "N/A", "Zoning": "Transition", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": null, "SIAmt": null, "SLAmt": 12497364.00, "SalePrice": 12497364.00, "UpdatedDate": "2016-11-15T11:21:31.373", "PropertyURL": null, "LongHeading": "AGRICULTURAL LAND", "ShortHeading": "AGR LAND", "SaleType": "SL" }, { "propertyid": "55e6d005-1fe6-4233-a456-5e7f35a7f1de", "Latitude": 5.386322, "Longitude": 100.380694, "road": "PERAI UTAMA 2 JALAN", "location": "PRAI", "state": "PENANG MAINLAND", "type": "3/S S/OFF", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 1306.00, "BuildUp": 1306.00, "Project": "TAMAN PERAI UTAMA", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 0, "Bathroom": 0, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Commercial", "Furnished": "", "FurnishedRemark": null, "Renovated": "", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 420000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 420000.00, "UpdatedDate": "2016-11-07T14:00:33.053", "PropertyURL": null, "LongHeading": "3 STOREY SHOP OFFICE, TAMAN PERAI UTAMA", "ShortHeading": "3/S S/OFF, TAMAN PERAI UTAMA", "SaleType": "SC" }, { "propertyid": "58938b6e-71d3-498f-bc3d-658ba55bc436", "Latitude": 5.320479, "Longitude": 100.447130, "road": "JURU 4 TINGKAT    ", "location": "JURU", "state": "PENANG MAINLAND", "type": "2/S S/D C", "staffid": "898e4c76-2654-4413-8dc2-5d8e1246c571", "agentname": "PATRICK SIOW", "mobile": "0194189918", "email": "patricksiow@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8846/28178296991_120d9245ce_o.jpg", "LandSqrtFt": 2964.00, "BuildUp": 2600.00, "Project": "TAMAN JURU", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "North East", "Zoning": "Residential", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 700000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 700000.00, "UpdatedDate": "2016-11-09T15:01:27.773", "PropertyURL": "https://farm6.staticflickr.com/5550/30238202343_a17952b84c.jpg", "LongHeading": "DOUBLE STOREY SEMI-DETACHED CORNER, TAMAN JURU", "ShortHeading": "2/S S/D C, TAMAN JURU", "SaleType": "SR" }, { "propertyid": "6c499d52-b3a5-428c-98d4-6f23f7a3db9f", "Latitude": 5.315944, "Longitude": 100.459957, "road": "PERMATANG TINGGI JALAN", "location": "PERMATANG TINGGI", "state": "PENANG MAINLAND", "type": "3/S S/OFF", "staffid": "898e4c76-2654-4413-8dc2-5d8e1246c571", "agentname": "PATRICK SIOW", "mobile": "0194189918", "email": "patricksiow@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8846/28178296991_120d9245ce_o.jpg", "LandSqrtFt": 1400.00, "BuildUp": 1400.00, "Project": "KAWASAN PERINDUSTRIAN ASAS JAYA", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 0, "Bathroom": 6, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "North East", "Zoning": "Commercial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 600000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 600000.00, "UpdatedDate": "2016-11-04T13:22:47.763", "PropertyURL": "https://farm6.staticflickr.com/5583/30131347173_7dd172c2fa.jpg", "LongHeading": "3 STOREY SHOP OFFICE, KAWASAN PERINDUSTRIAN ASAS JAYA", "ShortHeading": "3/S S/OFF, KAWASAN PERINDUSTRIAN ASAS JAYA", "SaleType": "SC" }, { "propertyid": "6957109f-cd8a-4d3e-9bfa-8eaa5212a4e8", "Latitude": 0.000000, "Longitude": 0.000000, "road": "HARBOUR PLACE JALAN", "location": "BUTTERWORTH", "state": "PENANG MAINLAND", "type": "CONDO", "staffid": "01e38f67-39f1-435a-94a8-21847ea4afe0", "agentname": "ALVIN TEH", "mobile": "0182575717", "email": "tjt@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/516/19162517368_b20643e0b1_o.jpg", "LandSqrtFt": 1087.00, "BuildUp": 1087.00, "Project": "PARK VIEW TOWER", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 3, "Bathroom": 2, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Partially Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 450000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 450000.00, "UpdatedDate": "2016-11-11T11:49:21.78", "PropertyURL": null, "LongHeading": "CONDOMINIUM, PARK VIEW TOWER", "ShortHeading": "CONDO, PARK VIEW TOWER", "SaleType": "SR" }, { "propertyid": "d6cb8a05-0500-4900-a2f7-a8f0e950d909", "Latitude": 5.268889, "Longitude": 100.435523, "road": "TANJUNG 1 LORONG", "location": "BATU KAWAN", "state": "PENANG MAINLAND", "type": "1/S TER", "staffid": "b58e6dd8-9fad-4c24-b984-d96b9c8cee2d", "agentname": "TEH HUN LIM", "mobile": "0194494825", "email": "tehhunlim@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/358/19164134319_d0c7416b72_o.jpg", "LandSqrtFt": 1000.00, "BuildUp": 800.00, "Project": "TAMAN MUTIARA TANJUNG", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 2, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Leasehold", "Facing": "N/A", "Zoning": "Residential", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 160000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 160000.00, "UpdatedDate": "2016-11-09T15:40:34.967", "PropertyURL": "https://farm6.staticflickr.com/5810/30785980841_4c3282c396.jpg", "LongHeading": "SINGLE STOREY TERRACE, TAMAN MUTIARA TANJUNG", "ShortHeading": "1/S TER, TAMAN MUTIARA TANJUNG", "SaleType": "SR" }, { "propertyid": "a3bf9a83-a11f-4a45-9197-a99670982dfb", "Latitude": 0.000000, "Longitude": 0.000000, "road": "ARGYLL JALAN", "location": "GEORGETOWN", "state": "PENANG ISLAND", "type": "2/S TER", "staffid": "783322d9-f9a4-43d7-89bf-b63812f49173", "agentname": "STEPHEN FOO", "mobile": "0124852981", "email": "stephenfoo@lskworld.com", "StaffPicURL": "https://farm4.staticflickr.com/3774/18727760624_3ff97e89e0_o.jpg", "LandSqrtFt": 700.00, "BuildUp": 1200.00, "Project": "GEORGETOWN", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Commercial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 750000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 750000.00, "UpdatedDate": "2016-11-03T10:32:42.767", "PropertyURL": null, "LongHeading": "DOUBLE STOREY TERRACE, GEORGETOWN", "ShortHeading": "2/S TER, GEORGETOWN", "SaleType": "SC" }, { "propertyid": "588312fb-d046-4901-9284-ad2e5fa93379", "Latitude": 5.238376, "Longitude": 100.473978, "road": "SERULING 5 LORONG", "location": "SUNGAI BAKAP", "state": "PENANG MAINLAND", "type": "1.5/S S/D", "staffid": "898e4c76-2654-4413-8dc2-5d8e1246c571", "agentname": "PATRICK SIOW", "mobile": "0194189918", "email": "patricksiow@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8846/28178296991_120d9245ce_o.jpg", "LandSqrtFt": 6500.00, "BuildUp": 2400.00, "Project": "KAWASAN PERINDUSTRIAN VALDOR", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 0, "Bathroom": 4, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "North West", "Zoning": "Industrial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": null, "SIAmt": 1400000.00, "SLAmt": null, "SalePrice": 1400000.00, "UpdatedDate": "2016-11-04T13:08:08.25", "PropertyURL": null, "LongHeading": "ONE & A HALF STOREY SEMI-DETACHED, KAWASAN PERINDUSTRIAN VALDOR", "ShortHeading": "1.5/S S/D, KAWASAN PERINDUSTRIAN VALDOR", "SaleType": "SI" }, { "propertyid": "ca082c96-fa69-429c-a2dc-bc6e217fa79a", "Latitude": 5.417573, "Longitude": 100.383720, "road": "CANTEK SOLOK", "location": "BUTTERWORTH", "state": "PENANG MAINLAND", "type": "2/S TER C", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 2000.00, "BuildUp": 1100.00, "Project": "TAMAN CANTEK", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Partially Furnished", "FurnishedRemark": null, "Renovated": "Partially Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 850000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 850000.00, "UpdatedDate": "2016-11-08T14:25:02.283", "PropertyURL": null, "LongHeading": "DOUBLE STOREY TERRACE CORNER, TAMAN CANTEK", "ShortHeading": "2/S TER C, TAMAN CANTEK", "SaleType": "SR" }, { "propertyid": "b5e4d1ad-2b2e-42d4-816a-c6fbd4cd5670", "Latitude": 0.000000, "Longitude": 0.000000, "road": "BAYU MUTIARA 2 LORONG", "location": "BUKIT TENGAH", "state": "PENANG MAINLAND", "type": "2/S TER", "staffid": "01e38f67-39f1-435a-94a8-21847ea4afe0", "agentname": "ALVIN TEH", "mobile": "0182575717", "email": "tjt@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/516/19162517368_b20643e0b1_o.jpg", "LandSqrtFt": 1400.00, "BuildUp": 1800.00, "Project": null, "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 550000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 550000.00, "UpdatedDate": "2016-11-07T18:31:06.567", "PropertyURL": null, "LongHeading": "DOUBLE STOREY TERRACE", "ShortHeading": "2/S TER", "SaleType": "SR" }, { "propertyid": "2116a3a0-1cde-4d49-a7dd-c91c0a578f75", "Latitude": 5.414152, "Longitude": 100.322034, "road": "MELAKA LEBUH", "location": "GEORGETOWN", "state": "PENANG ISLAND", "type": "2/S S/HSE", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 909.00, "BuildUp": 909.00, "Project": "GEORGETOWN", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 0, "Bathroom": 0, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Commercial", "Furnished": "", "FurnishedRemark": null, "Renovated": "", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 1400000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 1400000.00, "UpdatedDate": "2016-11-11T10:00:44.027", "PropertyURL": null, "LongHeading": "DOUBLE-STOREY SHOPHOUSE, GEORGETOWN", "ShortHeading": "2/S S/HSE, GEORGETOWN", "SaleType": "SC" }, { "propertyid": "6ab69a27-65ce-4090-83d1-d273d582f374", "Latitude": 5.417359, "Longitude": 100.380588, "road": "RAJA UDA JALAN", "location": "RAJA UDA", "state": "PENANG MAINLAND", "type": "4/S S/HSE", "staffid": "b9fe0256-e070-473f-86f0-c6bb9bfa0531", "agentname": "OOI JYH SIANG", "mobile": "0172509595", "email": "jsooi@lskworld.com", "StaffPicURL": "https://farm9.staticflickr.com/8572/28152375032_d1abf44b2c_o.jpg", "LandSqrtFt": 1400.00, "BuildUp": 1400.00, "Project": "WOLLEY", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Commercial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 250000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 250000.00, "UpdatedDate": "2016-11-11T09:59:36.447", "PropertyURL": null, "LongHeading": "4-STOREY SHOPHOUSE, WOLLEY", "ShortHeading": "4/S S/HSE, WOLLEY", "SaleType": "SC" }, { "propertyid": "9c8e3e5e-629c-4877-8352-d5ddb7e8cf85", "Latitude": 0.000000, "Longitude": 0.000000, "road": "JERMAL INDAH LORONG", "location": "BAGAN JERMAL", "state": "PENANG MAINLAND", "type": "3/S TOWNHSE", "staffid": "01e38f67-39f1-435a-94a8-21847ea4afe0", "agentname": "ALVIN TEH", "mobile": "0182575717", "email": "tjt@lskworld.com", "StaffPicURL": "https://farm1.staticflickr.com/516/19162517368_b20643e0b1_o.jpg", "LandSqrtFt": 2200.00, "BuildUp": 2200.00, "Project": "TAMAN JERMAL INDAH", "ProjectRemark": null, "Developer": null, "PropertyDesc": "1.5 storey at ground floor", "Room": 4, "Bathroom": 3, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 500000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 500000.00, "UpdatedDate": "2016-11-11T14:48:58.45", "PropertyURL": null, "LongHeading": "3-STOREY TOWN HOUSE, TAMAN JERMAL INDAH", "ShortHeading": "3/S TOWNHSE, TAMAN JERMAL INDAH", "SaleType": "SR" }, { "propertyid": "6e0b9020-0224-46b8-8b64-d66d9047ad17", "Latitude": 0.000000, "Longitude": 0.000000, "road": "HARBOUR PLACE JALAN", "location": "BUTTERWORTH", "state": "PENANG MAINLAND", "type": "CONDO", "staffid": "92254a34-aa2a-4df5-ba58-65817b84279c", "agentname": "RAYMOND", "mobile": "0182202821", "email": "raymond@lskworld.com", "StaffPicURL": "https://farm2.staticflickr.com/1457/26473641096_2ff9a0431f_o.jpg", "LandSqrtFt": 1285.00, "BuildUp": 1285.00, "Project": "SEAVIEW TOWER", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 3, "Bathroom": 2, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 460000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 460000.00, "UpdatedDate": "2016-11-10T10:25:21.813", "PropertyURL": null, "LongHeading": "CONDOMINIUM, SEAVIEW TOWER", "ShortHeading": "CONDO, SEAVIEW TOWER", "SaleType": "SR" }, { "propertyid": "7f02126f-c540-452a-811e-ead46e2b8d18", "Latitude": 5.389269, "Longitude": 100.306887, "road": "BATU LANCHANG JALAN", "location": "JELUTONG", "state": "PENANG ISLAND", "type": "CONDO", "staffid": "1c3d41c2-a29a-44ce-8247-efd8cf67d75d", "agentname": "FOH CHOON SENG", "mobile": "0164402800", "email": "csfoh@lskworld.com", "StaffPicURL": "https://farm2.staticflickr.com/1617/26473478476_6aaedb7fbb_o.jpg", "LandSqrtFt": 2600.00, "BuildUp": 2600.00, "Project": "CENTRAL PARK CONDO", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 5, "Bathroom": 4, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "", "Zoning": "Residential", "Furnished": "Furnished", "FurnishedRemark": null, "Renovated": "Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": 1500000.00, "SCAmt": null, "SIAmt": null, "SLAmt": null, "SalePrice": 1500000.00, "UpdatedDate": "2016-11-08T15:14:51.717", "PropertyURL": "https://farm6.staticflickr.com/5518/30553441460_ae96b4a33b.jpg", "LongHeading": "CONDOMINIUM, CENTRAL PARK CONDO", "ShortHeading": "CONDO, CENTRAL PARK CONDO", "SaleType": "SR" }, { "propertyid": "5f9ea882-63a2-449d-ab96-f5f027a28f05", "Latitude": 5.415300, "Longitude": 100.379475, "road": "RAJA UDA JALAN", "location": "RAJA UDA", "state": "PENANG MAINLAND", "type": "3/S S/OFF (2/F)", "staffid": "492ae819-4f18-43f6-971c-a7b339735cc8", "agentname": "COON KEONG", "mobile": "0174236232", "email": "coonkeong@lskworld.com", "StaffPicURL": "https://farm2.staticflickr.com/1682/25896582973_21a1c0ba5d_o.jpg", "LandSqrtFt": 1400.00, "BuildUp": 1400.00, "Project": "WOLLEY", "ProjectRemark": null, "Developer": null, "PropertyDesc": null, "Room": 1, "Bathroom": 1, "FloorLoad": null, "Ceiling": null, "BestBuy": 0, "Tenure": "Freehold", "Facing": "East", "Zoning": "Commercial", "Furnished": "Not Furnished", "FurnishedRemark": null, "Renovated": "Not Renovated", "RenovatedRemark": null, "Condition": "", "SRAmt": null, "SCAmt": 250000.00, "SIAmt": null, "SLAmt": null, "SalePrice": 250000.00, "UpdatedDate": "2016-11-10T12:26:01.507", "PropertyURL": "https://farm6.staticflickr.com/5821/30254208173_7b17da7cb9.jpg", "LongHeading": "3 STOREY SHOP OFFICE (2ND FLOOR), WOLLEY", "ShortHeading": "3/S S/OFF (2/F), WOLLEY", "SaleType": "SC" }];

            $scope.searchData = dummyData;
            console.log($scope.searchData.length);
            $scope.totalItems = $scope.searchData.length;
            $scope.currentPage = 1;
            $scope.numPerPage = 10;
        } else {
            $http.post('api/PropertySearch/GetAllNewSaleProperty').success(function (data) {
                console.log("New Sale: " + JSON.stringify(data));
                $scope.searchData = data;
                $scope.totalItems = $scope.searchData.length;
                $scope.currentPage = 1;
                $scope.numPerPage = 10;
            });
        }
    }



});